from django import forms
from .models import Topic, Entry

class TopicForm(forms.ModelForm):
	#一般都是这样写
	class Meta:
		#告诉django根据哪一个model创建表单
		model = Topic
		#表单包含text的字段
		fields = ['text']
		#告诉django不要为text字段生成标签,只是界面显示用
		labels = {'text': ''}
		#默认只会显示一个很小的输入框，这里用widgets定制显示
		widgets = {'text':forms.Textarea(attrs={'cols':80})}


class EntryForm(forms.ModelForm):
	class Meta:
		model = Entry
		fields = ['text']
		lables = {'text': ''}
		widgets = {'text':forms.Textarea(attrs={'cols':80})}
		

		